package com.itheima.domain.vo;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.itheima.domain.db.Log;
import com.itheima.domain.db.User;
import com.itheima.domain.db.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDetailVo implements Serializable {

    //    userInfo 11个
    private Long id; //用户id
    private String nickname; //昵称
    private String avatar; //用户头像
    private String gender; //性别
    private String city; //城市
    private String income; //收入
    private String tags; //用户标签：多个用逗号分隔
    private Integer age; //年龄
    private String profession; //行业
    private String userStatus;//冻结状态
    @TableField(fill = FieldFill.INSERT)
    private Date created;

    //    user 1个
    private String phone; //手机号

    //    log 2个
    private String logTime;//操作时间
    private String place;//登陆地点

    //    创建3个数据
    private Long eachLoveCount; //互相喜欢
    private Long loveCount; //喜欢
    private Long fanCount; //粉丝

    // 设置userInfo信息
    public void setUserInfo(UserInfo userInfo) {
        if (userInfo != null) {
            BeanUtil.copyProperties(userInfo, this);
        }
    }

    // 设置user信息
    public void setUser(User user) {
        if (user != null) {
            BeanUtil.copyProperties(user, this);
        }
    }

    // 设置log信息
    public void setLog(Log log) {
        if (log != null) {
            BeanUtil.copyProperties(log, this);
        }
    }
}
